import vcr
import requests

import vcr  
import requests
import vcr
 
# 创建VCR对象
my_vcr = vcr.VCR(
    cassette_library_dir='cassettes',  # 录音带存放目录
    path_transformer=vcr.VCR.ensure_suffix('.yaml'),  # 确保录音带文件后缀为.yaml
    record_mode='once',  # 录制模式
)
 
# 记录HTTP请求和响应
with my_vcr.use_cassette('example'):
    response = requests.get('https://jsonplaceholder.typicode.com/posts/1')
    print(response.json())